home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINSOUND / CHIMES.ZIP / CHIMES.CPP next >
C/C++ Source or Header  |  1993-06-02  |  2KB  |  132 lines

  1. // chimes.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "chimes.h"
  5.  
  6. #include "afxdlgs.h"
  7.  
  8.  
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. // theApp:
  12. // Just creating this application object runs the whole application.
  13. //
  14. CTheApp theApp;
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17.  
  18.  
  19. // CMainWindow constructor:
  20. // Create the window with the appropriate style, size, menu, etc.
  21. //
  22. CMainWindow::CMainWindow()
  23. {
  24.     RECT r;
  25.     
  26.     r = rectDefault;
  27.     r.right = r.left + 500;
  28.     r.bottom = r.top + 500;
  29.     
  30.     VERIFY(LoadAccelTable( "MainAccelTable" ));
  31.     VERIFY(Create( NULL, "MIDI Chimes",
  32.         WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME,
  33.         r, NULL, "MainMenu" ));
  34.         
  35. }
  36.  
  37. CMainWindow::~CMainWindow()
  38. {
  39.     delete p_dlg;
  40. }
  41.  
  42. // OnCreate
  43. //
  44.  
  45. int CMainWindow::OnCreate( LPCREATESTRUCT /* lpcs */)
  46. {
  47.     
  48.     // Set up the dialog
  49.     
  50.     p_dlg = new CMyMainDialog(this);
  51.  
  52.     return 0;
  53. }
  54.  
  55. // OnPlayStop
  56. //
  57.  
  58. void
  59. CMainWindow::OnPlayStop()
  60. {
  61.     p_dlg->playstop();
  62. }
  63.  
  64. // OnAbout:
  65. //
  66.  
  67. void CMainWindow::OnAbout()
  68. {
  69.     CModalDialog about( "AboutBox", this );
  70.     about.DoModal();
  71. }
  72.  
  73. // OnProgram:
  74. //
  75.  
  76.  
  77. // OnExit:
  78. //
  79.  
  80. void CMainWindow::OnExit()
  81. {
  82.     p_dlg->cleanup();
  83.     DestroyWindow();
  84. }
  85.  
  86. void CMainWindow::OnClose()
  87. {
  88.     p_dlg->cleanup();
  89.     DestroyWindow();
  90. }
  91.  
  92. // OnOpen:
  93. //
  94.  
  95. void CMainWindow::OnOpen()
  96. {
  97. }
  98.  
  99. // CMainWindow message map:
  100. // Associate messages with member functions.
  101. //
  102. // It is implied that members connected with the ON_COMMAND macro
  103. // receive no arguments and are void of return type, e.g., "void OnAbout()".
  104. //
  105. BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd )
  106.     ON_COMMAND( IDM_ABOUT, OnAbout )
  107.     ON_COMMAND( IDM_OPEN,  OnOpen )
  108.     ON_COMMAND( IDM_EXIT,  OnExit )
  109.     ON_COMMAND( IDM_PLAYSTOP, OnPlayStop )
  110.     ON_WM_CREATE()
  111.     ON_WM_CLOSE()
  112. END_MESSAGE_MAP()
  113.  
  114. /////////////////////////////////////////////////////////////////////////////
  115. // CTheApp
  116.  
  117. // InitInstance:
  118. // When any CTheApp object is created, this member function is automatically
  119. // called.  Any data may be set up at this point.
  120. //
  121. // Also, the main window of the application should be created and shown here.
  122. // Return TRUE if the initialization is successful.
  123. //
  124. BOOL CTheApp::InitInstance()
  125. {
  126.     m_pMainWnd = new CMainWindow();
  127.     m_pMainWnd->ShowWindow( m_nCmdShow );
  128.     m_pMainWnd->UpdateWindow();
  129.  
  130.     return TRUE;
  131. }
  132.